<template name="components">
	<view>
		<!-- <cu-custom bgColor="bg-green" ><block slot="content">推流</block></cu-custom>
		<view class="padding">
			<button class="cu-btn block lg  bg-gradual-green" style="margin-top: 45%;" @tap="gopush">开启推流</button>
		</view> -->
		
		
		<scroll-view scroll-y class="scrollPage">
		  <view class="UCenter-bg">
		    <image :src="userinfo.avatar" class="round png" mode="widthFix"></image>
		    <view class="text-xl">{{userinfo.nickname}}
		      <text class="text-df">v2.0</text>
		    </view>
		    <view class="margin-top-sm">
		      <text>{{userinfo.bio}}</text>
		    </view>
		    <image src="https://raw.githubusercontent.com/weilanwl/ColorUI/master/demo/images/wave.gif" mode="scaleToFill" class="gif-wave"></image>
		  </view>
		  <view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius">
			<view class="cu-item arrow">
			  <view class="content" @tap="gopush">
			    <text class="cuIcon-record text-red"></text>
			    <text class="text-grey">我的直播</text>
			  </view>
			</view>
		    <view class="cu-item arrow">
		      <view class="content"  data-link="https://github.com/weilanwl/ColorUI">
		        <text class="cuIcon-github text-grey"></text>
		        <text class="text-grey">GitHub</text>
		      </view>
		    </view>
		    <view class="cu-item arrow">
		      <navigator class="content" url="/pages/about/about" hover-class="none">
		        <image src="/images/logo.png" class="png" mode="aspectFit"></image>
		        <text class="text-grey">关于我们</text>
		      </navigator>
		    </view>
		    <view class="cu-item arrow">
		      <view class="content" @tap="showQrcode">
		        <text class="cuIcon-appreciatefill text-red"></text>
		        <text class="text-grey">赞赏支持</text>
		      </view>
		    </view>
		    <view class="cu-item arrow">
		      <button class="cu-btn content" open-type="feedback">
		        <text class="cuIcon-writefill text-cyan"></text>
		        <text class="text-grey">意见反馈</text>
		      </button>
		    </view>
		  </view>
		  <view class="cu-tabbar-height"></view>
		</scroll-view>
		
		
	</view>
</template>

<script>
	import { mapState,mapMutations } from 'vuex';
	export default {
		name: "components",
		data() {
			return {
				myroom:false
			};
		},
		computed: {
			...mapState(['userinfo','config'])
		},
		created() {
			this.$fire.on('update',(e)=>{
				console.log('update events is happend')
				this.getuser()
			})
			this.getuser()
		},
		methods: {
			...mapMutations(['setUserinfo']),
			getuser(){
				this.util.csAjax('/addons/live/api.user/index',{},(ret)=>{
					console.log(ret)
					ret.data.avatar = this.util.imgUrlfix(ret.data.avatar)
					this.setUserinfo(ret.data)
					this.getmyroom()
				})
			},
			gopush(){
				if(this.myroom){
					uni.navigateTo({
						url:'/pages/myroom/myroom?query='+encodeURIComponent(JSON.stringify(this.myroom))
					})
				}else{
					uni.navigateTo({
						url:'/pages/applyLive/applyLive'
					})
				}
				
			},
			getmyroom(){
				this.util.csAjax('/addons/live/api.room/myroom',{},(ret)=>{
					console.log(ret)
					this.myroom = ret.data
					
				})
			}
		},
	}
</script>

<style>
	.page {
		height: 100vh;
	}

	.console_box{
		position: absolute;
		width: 100%;
		height: 300rpx;
		margin: 0;
		left: 0;
		right: 0;
		display:table-cell; 
		vertical-align:bottom;
		background-color: rgba(0,0,0,0.4);
		color: #00FF02;
	}
	.control_bar{
		width: 100%;
		position: absolute;
		z-index: 9;
		left: 0;
		right: 0;
		bottom: 0;
	}
	
	.UCenter-bg {
	  background-image: url(https://cdn.nlark.com/yuque/0/2019/jpeg/280373/1552834692650-assets/web-upload/5a38c3b7-0636-4d85-883e-cba45a5a5fda.jpeg);
	  background-size: cover;
	  height: 550rpx;
	  display: flex;
	  justify-content: center;
	  padding-top: 40rpx;
	  overflow: hidden;
	  position: relative;
	  flex-direction: column;
	  align-items: center;
	  color: #fff;
	  font-weight: 300;
	  text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
	}
	
	.UCenter-bg text {
	  opacity: 0.8;
	}
	
	.UCenter-bg image {
	  width: 200rpx;
	  height: 200rpx;
	}
	
	.UCenter-bg .gif-wave{
	  position: absolute;
	  width: 100%;
	  bottom: 0;
	  left: 0;
	  z-index: 99;
	  mix-blend-mode: screen;  
	  height: 100rpx;   
	}
	
	map,.mapBox{
	  left: 0;
	  z-index: 99;
	  mix-blend-mode: screen;  
	  height: 100rpx;   
	}
	
	map,.mapBox{
	  width: 750rpx;
	  height: 300rpx;
	}
	
</style>
